package com.dcits.components;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class GracefulShutdown implements ApplicationListener<ContextClosedEvent> {

    @Override
    public void onApplicationEvent(ContextClosedEvent event) {
        // 1. 停止消息队列消费者
        // 2. 等待缓存同步完成
        // 3. 其他自定义清理
        log.info("系统优雅停机中...");
    }
}